// 格式化时间
export const formatTime = (time: string): string => {
  if (!time) return '-'
  const match = time.match(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/)
  if (!match) return time
  return `${match[1]}-${match[2]}-${match[3]} ${match[4]}:${match[5]}:${match[6]}`
}

// 格式化大小
export const formatSize = (size: string): string => {
  if (!size) return '-'
  const match = size.match(/^([\d.]+)\s*([A-Z]+)$/)
  if (!match) return size
  const value = parseFloat(match[1])
  const unit = match[2]
  
  if (value >= 1024) {
    return `${(value / 1024).toFixed(2)} TB`
  }
  return `${value.toFixed(2)} ${unit}`
} 